package com.yilin.tms.core.entity.order.clearing;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yilin.tms.core.commons.base.BaseDataEntity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;

/**
 * 汇总记录表
 *
 * @Author: zhangjinyuan
 * @CreateTime: 2023-02-15  09:33
 */
@Entity
@Table(name = "order_gather_record")
@TableName(value = "order_gather_record")
public class GatherRecord extends BaseDataEntity {
    /**
     * 汇总状态
     */
    public enum GatherStatus {
        create(0, "已创建"),
        confirmed(1, "成功"),
        scrap(2, "作废"),
        deal(3, "处理中");
        @EnumValue
        public Integer index;
        public String name;

        GatherStatus(Integer index, String name) {
            this.index = index;
            this.name = name;
        }
    }

    /**
     * 基本信息
     */
    @Column(name = "gather_record_no")
    private String gatherRecordNo;//汇总编号
    @Column(name = "gather_status")
    private GatherStatus gatherStatus;//汇总状态
    /**
     * 运单信息 存在多条运单
     */
    @Column(name = "transit_order_ids", columnDefinition = "TEXT")
    private String transitOrderIds;//运单ID 多条运单","隔开
    @Column(name = "transit_order_nos", columnDefinition = "TEXT")
    private String transitOrderNos; //运单号 多条运单","隔开
    @Column(name = "matchmaking")
    private Boolean matchmaking;//是否撮合业务
    @Column(name = "included_tax")
    private Boolean includedTax;//运费是否含税
    /**
     * 货主信息
     */
    @Column(name = "shipper_organize_id")
    private String shipperOrganizeId;//货主组织id
    @Column(name = "shipper_organize_name")
    private String shipperOrganizeName; //货主组织名称 公司名称 所有权人
    /**
     * 车主信息
     */
    @Column(name = "rob_organize_id")
    private String robOrganizeId;//车主组织id
    @Column(name = "rob_organize_name")
    private String robOrganizeName;//车主组织/公司/所有人名称
    /**
     * 汇总操作人
     */
    @Column(name = "lock_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date lockTime;//操作锁定时间
    @Column(name = "opt_account_id")
    private String optAccountId; //操作人ID
    @Column(name = "opt_account_name")
    private String optAccountName;//操作人名称
    @Column(name = "opt_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date optTime;//最后操作时间
    @Column(name = "confirm_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date confirmTime;//确认时间
    @Column(name = "scrap_account_id")
    private String scrapAccountId;//作废操作人ID
    @Column(name = "scrap_account_name")
    private String scrapAccountName;//作废操作人名称
    @Column(name = "scrap_reason")
    private String scrapReason;//作废原因
    @Column(name = "scrap_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date scrapTime;//作废时间
    @Column(name = "auto_sure_clearing")
    private Boolean autoSureClearing = false;//自动清算
    /**
     * 录入前可变
     * */
    @Column(name = "shipper_fee_rate")
    private Double shipperFeeRate; // 货主手续费率
    @Column(name = "shipper_tax_rate")
    private Double shipperTaxRate;// 货主预付不含税税率
    @Column(name = "insurance_rate")
    private Double insuranceRate; // 保率[保费跟随运单，不在汇总范畴]
    @Column(name = "trucker_fee_rate")
    private Double truckerFeeRate; // 车主手续费率
    @Column(name = "added_tax_rate")
    private Double addedTaxRate; //-增值税率
    @Column(name = "city_tax_rate")
    private Double cityTaxRate; //-城建税率 基于增值税
    @Column(name = "local_edu_tax_rate")
    private Double localEduTaxRate; //-地方教育税率 基于增值税
    @Column(name = "edu_add_tax_rate")
    private Double eduAddTaxRate; //-教育附加税率 基于增值税
    @Column(name = "income_tax_rate")
    private Double incomeTaxRate; //-个人所得税率
    /**
     * 货主真实付款费用 不是运输费
     * */
    @Column(name = "gather_actual_pay_cost")
    private Double gatherActualPayCost;//必填
    //汇总运输费
    //承运：gatherTotalCost / (1 + shipperFeeRate)
    //撮合：gatherTotalCost / (1 + shipperTaxRate + shipperFeeRate)
    @Column(name = "gather_total_transport_cost")
    private Double gatherTotalTransportCost=0D;
    //汇总货主税费(撮合): = gatherTotalTransportCost * shipperTaxRate
    @Column(name = "gather_shipper_tax_cost")
    private Double gatherShipperTaxCost=0D;
    //汇总货主服务费： = gatherTotalTransportCost * shipperFeeRate
    @Column(name = "gather_shipper_fee_cost")
    private Double gatherShipperFeeCost=0D;
    //汇总附加费【手填】
    @Column(name = "gather_additional_cost")
    private Double gatherAdditionalCost=0D;
    //总保费合计【累加】
    @Column(name = "total_insurance_cost")
    private Double totalInsuranceCost=0D;

    //汇总司机服务费
    @Column(name = "gather_trucker_fee_cost")
    private Double gatherTruckerFeeCost = 0D;// = gatherTotalTransportCost * truckerFeeRate
    //汇总税费列表
    @Column(name = "gather_added_tax_cost")
    private Double gatherAddedTaxCost = 0D;  //增值税
    @Column(name = "gather_city_tax_cost")
    private Double gatherCityTaxCost = 0D;//城建税 基于增值税
    @Column(name = "gather_local_edu_tax_cost")
    private Double gatherLocalEduTaxCost = 0D;//地方教育税 基于增值税
    @Column(name = "gather_edu_add_tax_cost")
    private Double gatherEduAddTaxCost = 0D;//教育附加税 基于增值税
    @Column(name = "gather_income_tax_cost")
    private Double gatherIncomeTaxCost = 0D;//个人所得税
    //汇总司机总税费
    @Column(name = "gather_trucker_tax_cost")
    private Double gatherTruckerTaxCost = 0D;// =
    //汇总磅差/货损 赔偿
    @Column(name = "gather_diff_indemnity_cost")
    private Double gatherDiffIndemnityCost = 0D;
    //汇总油费
    @Column(name = "gather_oil_cost")
    private Double gatherOilCost = 0D;
    //汇总ETC过路费
    @Column(name = "gather_etc_toll_cost")
    private Double gatherEtcTollCost = 0D;
    //汇总平台最终付款给车主汇总的费用
    //司机理论费用
    @Column(name = "gather_trucker_theory_cost")
    private Double gatherTruckerTheoryCost= 0D;

    //TODO:通道服务费 恢复司机
    @Column(name = "gather_technical_fee_cost")
    private Double gatherTechnicalFeeCost= 0D;

    //汇总平台最终付款给车主汇总的费用 司机理论费用-通道服务费
    @Column(name = "gather_trucker_income_cost")
    private Double gatherTruckerIncomeCost = 0D;

    public Double getGatherTruckerTheoryCost() {
        return gatherTruckerTheoryCost;
    }

    public void setGatherTruckerTheoryCost(Double gatherTruckerTheoryCost) {
        this.gatherTruckerTheoryCost = gatherTruckerTheoryCost;
    }

    public Double getGatherTechnicalFeeCost() {
        return gatherTechnicalFeeCost;
    }

    public void setGatherTechnicalFeeCost(Double gatherTechnicalFeeCost) {
        this.gatherTechnicalFeeCost = gatherTechnicalFeeCost;
    }

    public Boolean getAutoSureClearing() {
        return autoSureClearing;
    }

    public void setAutoSureClearing(Boolean autoSureClearing) {
        this.autoSureClearing = autoSureClearing;
    }

    public Date getConfirmTime() {
        return confirmTime;
    }

    public void setConfirmTime(Date confirmTime) {
        this.confirmTime = confirmTime;
    }

    public Boolean getMatchmaking() {
        return matchmaking;
    }

    public void setMatchmaking(Boolean matchmaking) {
        this.matchmaking = matchmaking;
    }

    public Boolean getIncludedTax() {
        return includedTax;
    }

    public void setIncludedTax(Boolean includedTax) {
        this.includedTax = includedTax;
    }

    public String getGatherRecordNo() {
        return gatherRecordNo;
    }

    public void setGatherRecordNo(String gatherRecordNo) {
        this.gatherRecordNo = gatherRecordNo;
    }

    public GatherStatus getGatherStatus() {
        return gatherStatus;
    }

    public void setGatherStatus(GatherStatus gatherStatus) {
        this.gatherStatus = gatherStatus;
    }

    public String getTransitOrderIds() {
        return transitOrderIds;
    }

    public void setTransitOrderIds(String transitOrderIds) {
        this.transitOrderIds = transitOrderIds;
    }

    public String getTransitOrderNos() {
        return transitOrderNos;
    }

    public void setTransitOrderNos(String transitOrderNos) {
        this.transitOrderNos = transitOrderNos;
    }

    public String getShipperOrganizeId() {
        return shipperOrganizeId;
    }

    public void setShipperOrganizeId(String shipperOrganizeId) {
        this.shipperOrganizeId = shipperOrganizeId;
    }

    public String getShipperOrganizeName() {
        return shipperOrganizeName;
    }

    public void setShipperOrganizeName(String shipperOrganizeName) {
        this.shipperOrganizeName = shipperOrganizeName;
    }

    public String getRobOrganizeId() {
        return robOrganizeId;
    }

    public void setRobOrganizeId(String robOrganizeId) {
        this.robOrganizeId = robOrganizeId;
    }

    public String getRobOrganizeName() {
        return robOrganizeName;
    }

    public void setRobOrganizeName(String robOrganizeName) {
        this.robOrganizeName = robOrganizeName;
    }

    public Date getLockTime() {
        return lockTime;
    }

    public void setLockTime(Date lockTime) {
        this.lockTime = lockTime;
    }

    public String getOptAccountId() {
        return optAccountId;
    }

    public void setOptAccountId(String optAccountId) {
        this.optAccountId = optAccountId;
    }

    public String getOptAccountName() {
        return optAccountName;
    }

    public void setOptAccountName(String optAccountName) {
        this.optAccountName = optAccountName;
    }

    public Date getOptTime() {
        return optTime;
    }

    public void setOptTime(Date optTime) {
        this.optTime = optTime;
    }

    public String getScrapAccountId() {
        return scrapAccountId;
    }

    public void setScrapAccountId(String scrapAccountId) {
        this.scrapAccountId = scrapAccountId;
    }

    public String getScrapAccountName() {
        return scrapAccountName;
    }

    public void setScrapAccountName(String scrapAccountName) {
        this.scrapAccountName = scrapAccountName;
    }

    public String getScrapReason() {
        return scrapReason;
    }

    public void setScrapReason(String scrapReason) {
        this.scrapReason = scrapReason;
    }

    public Date getScrapTime() {
        return scrapTime;
    }

    public void setScrapTime(Date scrapTime) {
        this.scrapTime = scrapTime;
    }

    public Double getShipperFeeRate() {
        return shipperFeeRate;
    }

    public void setShipperFeeRate(Double shipperFeeRate) {
        this.shipperFeeRate = shipperFeeRate;
    }

    public Double getShipperTaxRate() {
        return shipperTaxRate;
    }

    public void setShipperTaxRate(Double shipperTaxRate) {
        this.shipperTaxRate = shipperTaxRate;
    }

    public Double getInsuranceRate() {
        return insuranceRate;
    }

    public void setInsuranceRate(Double insuranceRate) {
        this.insuranceRate = insuranceRate;
    }

    public Double getTruckerFeeRate() {
        return truckerFeeRate;
    }

    public void setTruckerFeeRate(Double truckerFeeRate) {
        this.truckerFeeRate = truckerFeeRate;
    }

    public Double getAddedTaxRate() {
        return addedTaxRate;
    }

    public void setAddedTaxRate(Double addedTaxRate) {
        this.addedTaxRate = addedTaxRate;
    }

    public Double getCityTaxRate() {
        return cityTaxRate;
    }

    public void setCityTaxRate(Double cityTaxRate) {
        this.cityTaxRate = cityTaxRate;
    }

    public Double getLocalEduTaxRate() {
        return localEduTaxRate;
    }

    public void setLocalEduTaxRate(Double localEduTaxRate) {
        this.localEduTaxRate = localEduTaxRate;
    }

    public Double getEduAddTaxRate() {
        return eduAddTaxRate;
    }

    public void setEduAddTaxRate(Double eduAddTaxRate) {
        this.eduAddTaxRate = eduAddTaxRate;
    }

    public Double getIncomeTaxRate() {
        return incomeTaxRate;
    }

    public void setIncomeTaxRate(Double incomeTaxRate) {
        this.incomeTaxRate = incomeTaxRate;
    }

    public Double getGatherActualPayCost() {
        return gatherActualPayCost;
    }

    public void setGatherActualPayCost(Double gatherActualPayCost) {
        this.gatherActualPayCost = gatherActualPayCost;
    }

    public Double getGatherTotalTransportCost() {
        return gatherTotalTransportCost;
    }

    public void setGatherTotalTransportCost(Double gatherTotalTransportCost) {
        this.gatherTotalTransportCost = gatherTotalTransportCost;
    }

    public Double getGatherShipperTaxCost() {
        return gatherShipperTaxCost;
    }

    public void setGatherShipperTaxCost(Double gatherShipperTaxCost) {
        this.gatherShipperTaxCost = gatherShipperTaxCost;
    }

    public Double getGatherShipperFeeCost() {
        return gatherShipperFeeCost;
    }

    public void setGatherShipperFeeCost(Double gatherShipperFeeCost) {
        this.gatherShipperFeeCost = gatherShipperFeeCost;
    }

    public Double getGatherAdditionalCost() {
        return gatherAdditionalCost;
    }

    public void setGatherAdditionalCost(Double gatherAdditionalCost) {
        this.gatherAdditionalCost = gatherAdditionalCost;
    }

    public Double getTotalInsuranceCost() {
        return totalInsuranceCost;
    }

    public void setTotalInsuranceCost(Double totalInsuranceCost) {
        this.totalInsuranceCost = totalInsuranceCost;
    }

    public Double getGatherTruckerFeeCost() {
        return gatherTruckerFeeCost;
    }

    public void setGatherTruckerFeeCost(Double gatherTruckerFeeCost) {
        this.gatherTruckerFeeCost = gatherTruckerFeeCost;
    }

    public Double getGatherAddedTaxCost() {
        return gatherAddedTaxCost;
    }

    public void setGatherAddedTaxCost(Double gatherAddedTaxCost) {
        this.gatherAddedTaxCost = gatherAddedTaxCost;
    }

    public Double getGatherCityTaxCost() {
        return gatherCityTaxCost;
    }

    public void setGatherCityTaxCost(Double gatherCityTaxCost) {
        this.gatherCityTaxCost = gatherCityTaxCost;
    }

    public Double getGatherLocalEduTaxCost() {
        return gatherLocalEduTaxCost;
    }

    public void setGatherLocalEduTaxCost(Double gatherLocalEduTaxCost) {
        this.gatherLocalEduTaxCost = gatherLocalEduTaxCost;
    }

    public Double getGatherEduAddTaxCost() {
        return gatherEduAddTaxCost;
    }

    public void setGatherEduAddTaxCost(Double gatherEduAddTaxCost) {
        this.gatherEduAddTaxCost = gatherEduAddTaxCost;
    }

    public Double getGatherIncomeTaxCost() {
        return gatherIncomeTaxCost;
    }

    public void setGatherIncomeTaxCost(Double gatherIncomeTaxCost) {
        this.gatherIncomeTaxCost = gatherIncomeTaxCost;
    }

    public Double getGatherTruckerTaxCost() {
        return gatherTruckerTaxCost;
    }

    public void setGatherTruckerTaxCost(Double gatherTruckerTaxCost) {
        this.gatherTruckerTaxCost = gatherTruckerTaxCost;
    }

    public Double getGatherDiffIndemnityCost() {
        return gatherDiffIndemnityCost;
    }

    public void setGatherDiffIndemnityCost(Double gatherDiffIndemnityCost) {
        this.gatherDiffIndemnityCost = gatherDiffIndemnityCost;
    }

    public Double getGatherOilCost() {
        return gatherOilCost;
    }

    public void setGatherOilCost(Double gatherOilCost) {
        this.gatherOilCost = gatherOilCost;
    }

    public Double getGatherEtcTollCost() {
        return gatherEtcTollCost;
    }

    public void setGatherEtcTollCost(Double gatherEtcTollCost) {
        this.gatherEtcTollCost = gatherEtcTollCost;
    }

    public Double getGatherTruckerIncomeCost() {
        return gatherTruckerIncomeCost;
    }

    public void setGatherTruckerIncomeCost(Double gatherTruckerIncomeCost) {
        this.gatherTruckerIncomeCost = gatherTruckerIncomeCost;
    }
}
